/* ICS Settings Styles */

/* Main container */
.ics-settings-container {
	padding: 1rem;
	max-width: 800px;
	margin: 0 auto;
}

/* Header section */
.ics-header-container {
	margin-bottom: 2rem;
	border-bottom: 1px solid var(--background-modifier-border);
	padding-bottom: 1rem;
}

.ics-back-button {
	background: var(--interactive-accent);
	color: var(--text-on-accent);
	border: none;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	cursor: pointer;
	margin-bottom: 1rem;
	font-size: 0.9em;
	transition: all 0.2s ease;
}

.ics-back-button:hover {
	background: var(--interactive-accent-hover);
	transform: translateY(-1px);
}

.ics-description {
	color: var(--text-muted);
	margin-top: 0.5rem;
	line-height: 1.5;
}

/* Global settings */
.ics-global-settings {
	margin-bottom: 2rem;
	padding: 1.5rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 8px;
	background: var(--background-secondary);
}

/* Sources list */
.ics-sources-list {
	margin-top: 1.5rem;
}

.ics-sources-list h3 {
	margin-bottom: 1rem;
	color: var(--text-normal);
}

.ics-source-item {
	margin-bottom: 1rem;
	padding: 1.5rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 8px;
	background: var(--background-primary);
	transition: all 0.2s ease;
}

.ics-source-item:hover {
	border-color: var(--interactive-accent);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ics-source-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
}

.ics-source-title strong {
	font-size: 1.1em;
	color: var(--text-normal);
}

.ics-source-status {
	padding: 0.3rem 0.8rem;
	border-radius: 12px;
	font-size: 0.75em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.status-enabled {
	background: var(--color-green);
	color: white;
}

.status-disabled {
	background: var(--color-red);
	color: white;
}

.ics-source-details {
	margin-bottom: 1.5rem;
	font-size: 0.9em;
	color: var(--text-muted);
	line-height: 1.4;
}

.ics-source-details div {
	margin-bottom: 0.4rem;
}

/* Action buttons */
.ics-source-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
}

.primary-actions,
.secondary-actions {
	display: flex;
	gap: 0.5rem;
}

.ics-source-actions button {
	padding: 0.5rem 1rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 6px;
	background: var(--background-secondary);
	color: var(--text-normal);
	font-size: 0.85em;
	cursor: pointer;
	transition: all 0.2s ease;
	min-width: 80px;
	white-space: nowrap;
}

.ics-source-actions button:hover {
	background: var(--background-modifier-hover);
	border-color: var(--interactive-accent);
	transform: translateY(-1px);
}

.ics-source-actions button.mod-cta {
	background: var(--interactive-accent);
	color: var(--text-on-accent);
	border-color: var(--interactive-accent);
}

.ics-source-actions button.mod-cta:hover {
	background: var(--interactive-accent-hover);
}

.ics-source-actions button.mod-warning {
	background: var(--color-red);
	color: white;
	border-color: var(--color-red);
}

.ics-source-actions button.mod-warning:hover {
	background: var(--color-red);
	opacity: 0.8;
}

.ics-source-actions button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.ics-source-actions button.syncing {
	color: var(--interactive-accent);
}

.ics-source-actions button.success {
	background: var(--color-green);
	color: white;
	border-color: var(--color-green);
}

.ics-source-actions button.error {
	background: var(--color-red);
	color: white;
	border-color: var(--color-red);
}

/* Add source container */
.ics-add-source-container {
	margin-top: 2rem;
	text-align: center;
	padding: 2rem;
	border: 2px dashed var(--background-modifier-border);
	border-radius: 8px;
	background: var(--background-secondary);
	transition: all 0.2s ease;
}

.ics-add-source-container:hover {
	border-color: var(--interactive-accent);
	background: var(--background-modifier-hover);
}

.ics-add-source-container button {
	background: var(--interactive-accent);
	color: var(--text-on-accent);
	border: none;
	padding: 0.8rem 1.5rem;
	border-radius: 6px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 0.95em;
}

.ics-add-source-container button:hover {
	background: var(--interactive-accent-hover);
	transform: translateY(-2px);
}

/* Test container */
.ics-test-container {
	margin-top: 1rem;
	text-align: center;
	padding: 1rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 8px;
	background: var(--background-modifier-form-field);
}

.ics-test-button {
	background: var(--color-orange);
	color: white;
	border: none;
	padding: 0.6rem 1.2rem;
	border-radius: 6px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 0.9em;
}

.ics-test-button:hover {
	background: var(--color-orange);
	opacity: 0.8;
	transform: translateY(-1px);
}

/* Empty state */
.ics-empty-state {
	text-align: center;
	padding: 3rem 2rem;
	color: var(--text-muted);
	font-style: italic;
	background: var(--background-secondary);
	border-radius: 8px;
	border: 1px solid var(--background-modifier-border);
}

/* Modal styles */
.ics-source-modal .modal-content {
	max-width: 600px;
	max-height: 80vh;
	overflow-y: auto;
}

.auth-field {
	margin-top: 0.5rem;
}

.modal-button-container {
	display: flex;
	gap: 0.5rem;
	justify-content: flex-end;
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--background-modifier-border);
}

.modal-button-container button {
	padding: 0.5rem 1rem;
	border-radius: 6px;
	font-size: 0.9em;
	min-width: 80px;
}

/* Responsive design */
@media (max-width: 768px) {
	.ics-source-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}

	.ics-source-actions {
		flex-direction: column;
		gap: 0.5rem;
	}

	.primary-actions,
	.secondary-actions {
		width: 100%;
		justify-content: space-between;
	}

	.ics-source-actions button {
		flex: 1;
		min-width: auto;
	}
}

@media (max-width: 480px) {
	.ics-settings-container {
		padding: 0.5rem;
	}

	.ics-source-item {
		padding: 1rem;
	}

	.primary-actions,
	.secondary-actions {
		flex-direction: column;
	}

	.ics-source-actions button {
		width: 100%;
		margin-bottom: 0.3rem;
	}

	.modal-button-container {
		flex-direction: column;
	}

	.modal-button-container button {
		width: 100%;
	}
}

/* Text Replacements Styles */
.text-replacements-list {
	margin: 1rem 0;
}

.text-replacements-empty {
	text-align: center;
	padding: 2rem;
	color: var(--text-muted);
	font-style: italic;
	background: var(--background-secondary);
	border-radius: 6px;
	border: 1px dashed var(--background-modifier-border);
}

.text-replacement-rule {
	margin-bottom: 1rem;
	padding: 1rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 6px;
	background: var(--background-primary);
	transition: all 0.2s ease;
}

.text-replacement-rule:hover {
	border-color: var(--interactive-accent);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-replacement-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.8rem;
}

.text-replacement-header strong {
	color: var(--text-normal);
	font-size: 1em;
}

.text-replacement-status {
	padding: 0.2rem 0.6rem;
	border-radius: 10px;
	font-size: 0.7em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.text-replacement-status.enabled {
	background: var(--color-green);
	color: white;
}

.text-replacement-status.disabled {
	background: var(--color-red);
	color: white;
}

.text-replacement-details {
	margin-bottom: 1rem;
	font-size: 0.85em;
	color: var(--text-muted);
	line-height: 1.4;
}

.text-replacement-details div {
	margin-bottom: 0.3rem;
}

.text-replacement-pattern {
	font-family: var(--font-monospace);
	background: var(--background-modifier-form-field);
	padding: 0.2rem 0.4rem;
	border-radius: 3px;
	display: inline-block;
	margin-left: 0.5rem;
}

.text-replacement-replacement {
	font-family: var(--font-monospace);
	background: var(--background-modifier-form-field);
	padding: 0.2rem 0.4rem;
	border-radius: 3px;
	display: inline-block;
	margin-left: 0.5rem;
}

.text-replacement-actions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.text-replacement-actions button {
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--background-modifier-border);
	border-radius: 4px;
	background: var(--background-secondary);
	color: var(--text-normal);
	font-size: 0.8em;
	cursor: pointer;
	transition: all 0.2s ease;
}

.text-replacement-actions button:hover {
	background: var(--background-modifier-hover);
	border-color: var(--interactive-accent);
}

.text-replacement-actions button.mod-cta {
	background: var(--interactive-accent);
	color: var(--text-on-accent);
	border-color: var(--interactive-accent);
}

.text-replacement-actions button.mod-warning {
	background: var(--color-red);
	color: white;
	border-color: var(--color-red);
}

.text-replacement-add {
	margin-top: 1rem;
	text-align: center;
}

.text-replacement-add button {
	background: var(--interactive-accent);
	color: var(--text-on-accent);
	border: none;
	padding: 0.6rem 1.2rem;
	border-radius: 6px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
}

.text-replacement-add button:hover {
	background: var(--interactive-accent-hover);
	transform: translateY(-1px);
}

/* Text Replacement Modal Styles */
.text-replacement-modal .modal-content {
	max-width: 700px;
	max-height: 85vh;
	overflow-y: auto;
}

.test-output {
	margin-top: 0.5rem;
	padding: 0.8rem;
	background: var(--background-modifier-form-field);
	border-radius: 4px;
	border: 1px solid var(--background-modifier-border);
	font-family: var(--font-monospace);
	font-size: 0.9em;
}

.test-result {
	font-weight: 500;
}

/* Examples section */
.text-replacement-modal ul {
	margin: 0.5rem 0;
	padding-left: 1.5rem;
}

.text-replacement-modal li {
	margin-bottom: 0.5rem;
	line-height: 1.4;
}

.text-replacement-modal code {
	background: var(--background-modifier-form-field);
	padding: 0.1rem 0.3rem;
	border-radius: 3px;
	font-family: var(--font-monospace);
	font-size: 0.85em;
}

/* Animation for sync button */
@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.ics-source-actions button.syncing::before {
	content: "";
	display: inline-block;
	margin-right: 0.3rem;
	animation: spin 1s linear infinite;
}

.ics-text-replacement-modal,
.ics-source-modal {
	max-width: 1000px;
	max-height: 90vh;

	padding-right: 0;
}

.ics-text-replacement-modal .modal-content,
.ics-source-modal .modal-content {
	padding-right: var(--size-4-2);
}
